﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page isELIgnored="false" %> 

<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@page import="net.ssta.core.web.RequestKit"%>
<%@ page import="net.ssta.core.db.PagingInfo"%>

<%
	String path = request.getContextPath();
	//分页参数
    PagingInfo pagingInfo =(PagingInfo) request.getAttribute("pagingInfo");
    int pageno = pagingInfo.getCurrentPageNo();
    
    Record searchRcd = (Record) request.getAttribute("searchRcd");
    
    //用户项目需求列表
    RecordSet kjcgNeedsSet = (RecordSet) request.getAttribute("kjcgNeedsSet");
    
    //新能源分类
    RecordSet newEnerClass = (RecordSet) request.getAttribute("newEnerClass");
    
    //需求缘由
    RecordSet needReason = (RecordSet) request.getAttribute("needReason");
    
    //合作方式
    RecordSet cooperate = (RecordSet) request.getAttribute("cooperate");
    
    //计划投入
    RecordSet planInvest = (RecordSet) request.getAttribute("planInvest");
    
    //所处阶段
    RecordSet stage = (RecordSet) request.getAttribute("stage");
    
    //代码、值Map
    Map fildOptionMap =  (HashMap)request.getAttribute("fildOptionMap");
    
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>


<link type="text/css" rel="stylesheet" href="<%=path%>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/ostable.css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/tab.css" />
<link rel="stylesheet" href="<%=path%>/includes/lhgdialog/lhgdialog.css" />



<script type='text/javascript' src="<%=path%>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/includes/styleBase/js/style.js"></script>
<script type="text/javascript" src="<%=path%>/includes/DatePicker/WdatePicker.js"></script>


<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgdialog.js"></script>

<title>项目需求后台管理</title>
 
<script type="text/javascript">

function handle()
{
	
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	var dlg = new J.ui.dialog({ id:'handlekjcgdemand',
		                         title:'处理项目需求',
		                         range:true,
		                         btns:true,
		                         page:'<%=path%>/back/userNeeds/HandleKjcgNeeds.jsp?kjcgUuids='+pids,
		                         width:700,
		                         height:400,
		                         windowObj:window});
	dlg.ShowDialog();
}

function onHandle()
{
	
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	if(confirm("您确认要把选择的记录设置为未处理状态，改操作会将以前的处理信息删除！")){
     $.ajax({
			type: "POST", url: "<%=path%>/back/UserNeedsManage?method=unHandKjcgNeeds&kjcgUuids="+pids,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("操作成功!");
				_goPage(<%=pageno%>);
			}
	 });
	}
	
}



function deleteKjcgNeed()
{
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
		}
	}
	
	if(confirm("您确定要删除选中的项目需求信息？信息一旦删除将不能恢复！")){
	$.ajax({
			type: "POST", url: "<%=path%>/back/UserNeedsManage?method=deleteKjcgUserNeeds&kjcgUuids="+pids,
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("操作成功!");
				_goPage(<%=pageno%>);
			}
	 });
	 }
}


function handleById(pids)
{
	var dlg = new J.ui.dialog({ id:'handleexpertdemand',
		                         title:'处理项目需求',
		                         range:true,
		                         btns:true,
		                         page:'<%=path%>/back/userNeeds/HandleKjcgNeeds.jsp?kjcgUuids='+pids,
		                         width:700,
		                         height:400,
		                         windowObj:window});
	dlg.ShowDialog();
}

function onHandleById(pids)
{
	if(confirm("您确认要把选择的记录设置为未处理状态，改操作会将以前的处理信息删除！")){
		 $.ajax({
				type: "POST", url: "<%=path%>/back/UserNeedsManage?method=unHandKjcgNeeds&kjcgUuids="+pids,
				error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
				success: function(msg){
					alert("操作成功!");
					_goPage(<%=pageno%>);
				}
		 });
	}
	
}

function doSearch()
{
	var form = document.getElementById("seaForm");
	form.submit();
}

function _showneedsinfo(uuid){
	window.open("<%=path%>/back/UserNeedsManage?method=kjcgNeedsById&kjcgUuids="+uuid)
}

//跳转
function reloadPage() 
{
	_goPage(<%=pageno%>);
}


function _selectall(){
	var uuids = document.getElementsByName("uuids");
	if(uuids.length){
		for(var i=0;i<uuids.length;i++){
			uuids[i].checked = document.getElementById("selectall").checked;
		}
	}
}


</script>

</head>
<body>
<form id="seaForm" name="seaForm" method="post" action="<%=path%>/back/UserNeedsManage?method=userKjcjNeedsList" >
	<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left">&nbsp;</td>
      <td class="box_top_center">项目需求信息查询</td>
      <td class="box_top_right">&nbsp;</td>
    </tr>
  </table>
</div>
<div class="infoDiv">
  <table border="0" cellpadding="0" cellspacing="0" class="trHeightTable">
    <tr>
      <td class="leftTipArea">标题</td>
      <td><input id="keyword" name="keyword" value="<%=searchRcd.getString("KEYWORD","")%>" class="textInput" style="width:120px;"/></td>
      <td class="leftTipArea">联系人</td>
      <td><input id="USERNAME" name="USERNAME" value="<%=searchRcd.getString("USERNAME","")%>" class="textInput" style="width:120px;"/></td>
      <td class="leftTipArea">机构名称</td>
      <td><input id="UNITNAME" name="UNITNAME" value="<%=searchRcd.getString("USERNAME","")%>" class="textInput" style="width:120px;"/></td>
    </tr>
    <tr>
      <td class="leftTipArea">提交时间</td>
      <td >
      	  <div class="select"><div>
          <select name="SUBMITDATE">
	  	  	<option value="">全部</option>
			<option value="1" <%if("1".equals(searchRcd.getString("SUBMITDATE"))){%>selected<%}%>>当天</option>
            <option value="2" <%if("2".equals(searchRcd.getString("SUBMITDATE"))){%>selected<%}%>>一周内</option>
            <option value="3" <%if("3".equals(searchRcd.getString("SUBMITDATE"))){%>selected<%}%>>一月内</option>
            <option value="4" <%if("4".equals(searchRcd.getString("SUBMITDATE"))){%>selected<%}%>>半年内</option>
          </select></div></div>
      </td>
      <td class="leftTipArea">处理状态</td>
      <td>
      	<div class="select"><div><select name="IFPROCESS">
	  	   	<option value="1" <%if("1".equals(searchRcd.getString("IFPROCESS"))){%>selected<%}%>>已处理</option>
	  	   	<option value="0" <%if("0".equals(searchRcd.getString("IFPROCESS"))){%>selected<%}%>>未处理</option>
           </select></div></div>
      </td>
      <td class="leftTipArea">&nbsp;</td>
      <td>
		   <a href="#2010" class="imgButton" onclick="doSearch();"><span>查询</span></a>
      </td>
    </tr>
    
  </table>
</div>

</form>

<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left" width="2">&nbsp;</td>
      <td class="box_top_center">查询结果列表</td>
      <td class="box_top_right" width="2">&nbsp;</td>
    </tr>
  </table>
</div>

<div class="contentBox">
    <table class="osTable" cellpadding="0" cellspacing="0" border="0">
      <thead>
        <tr >
          <th  width="7%"><input type="checkbox" id="selectall" name="selectall" onclick="javascript:_selectall();" value=""/>选择</th>
          <th  width="18%">标题</th>
          <th  width="10%" >联系人</th>
          <th  width="12%" >机构名称</th>
          <th  width="12%" >提交日期</th>
          <th  width="8%" >是否已处理</th>
          <th  width="11%" >操作</th>
        </tr>
      </thead>
      <tbody>
      	<%
      	int i=0;
      	for(i=0;i<kjcgNeedsSet.size();i++){
      		Record kjcgNeedRecord = kjcgNeedsSet.get(i);
      		String showStr="";
			String fontcolor = "#000000";
			if(kjcgNeedRecord.getString("IFPROCESS","").equals("0")){
				fontcolor = "red";
			}
      	%>
	        <tr >
	          <td><input type="checkbox" name="uuids" value="<%=kjcgNeedRecord.getString("ID","")%>"/></td>
	          <td style="color:<%=fontcolor%>;"><a href="javascript:_showneedsinfo('<%=kjcgNeedRecord.getString("ID","")%>')" style="color:<%=fontcolor%>;"><%=kjcgNeedRecord.getString("TITLE","")%></a></td>
	          <td style="color:<%=fontcolor%>;"><%=kjcgNeedRecord.getString("LINKMAN","")%></td>
	          <td style="color:<%=fontcolor%>;"><%=kjcgNeedRecord.getString("UNITNAME","")%></td>
	          <td style="color:<%=fontcolor%>;"><%=kjcgNeedRecord.getString("SUBMITDATE","")%></td>
	          <td style="color:<%=fontcolor%>;"><%=kjcgNeedRecord.getString("IFPROCESS","").equals("0")?"未处理":"已处理"%></td>
              <td style="color:<%=fontcolor%>;">
			  	<%
				if(kjcgNeedRecord.getString("IFPROCESS","").equals("1")){
				%>
                	<a href="javascript:onHandleById('<%=kjcgNeedRecord.getString("ID","")%>')">标记未处理</a>
				<%
				}else{
				%>
                	<a href="javascript:handleById('<%=kjcgNeedRecord.getString("ID","")%>')">标记已处理</a>
                <%
				}
				%>
                </td>
	        </tr>
	        <%}
	        
	         for(int j=0;j<pagingInfo.getPageSize()-kjcgNeedsSet.size();j++){ %>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
                        <td>&nbsp;</td>
					</tr>
				<%
			}%>
      </tbody>
    </table>
<div class="navDiv">
	    <div class="navLeftDiv">
		    <!--<a href="#2010" class="imgButton" onclick="handle();"><span>处理</span></a>-->
		    <a href="#2010" class="imgButton" onclick="onHandle();"><span>标记未处理</span></a>
		    <a href="#2010" class="imgButton" onclick="deleteKjcgNeed();"><span>删除</span></a>
	    </div>
	    <div  class="navRightDiv">
			<jsp:include flush="true" page="/common/paging.jsp"></jsp:include>
		</div>
	</div>
</div>

</body> 
</html>